package com.cet.hello;

/**
 * @program: algorithm
 * @description:
 * @author: 陈恩涛
 * @create: 2021-04-20 17:33
 **/
public class Demo02 {
    public static void main(String[] args) {
        //返回虚拟机试图使用的最大内存
        long maxMemory = Runtime.getRuntime().maxMemory();
        //返回jvm总内存
        long totalMemory = Runtime.getRuntime().totalMemory();

        System.out.println("maxMemory="+(maxMemory/(double)(1024*1024))+"M");
        System.out.println("totalMemory="+(totalMemory/(double)(1024*1024))+"M");

        //默认情况下，分配的总内存为电脑内存的 1/4，而初始化内存为 1/64

        //-Xms1024m -Xmx1024m -XX:+PrintGCDetails
    }
}
